Version Property Example

This example uses the Version property to report on the Microsoft Jet database engine in memory, a Microsoft Jet database, and an ODBC connection.

Sub VersionX()

   Dim wrkJet As Workspace
   Dim dbsNorthwind As Database
   Dim wrkODBC As Workspace
   Dim conPubs As Connection

   ' Open Microsoft Jet Database object.
   Set wrkJet = CreateWorkspace("NewJetWorkspace", _
      "admin", "", dbUseJet)
   Set dbsNorthwind = wrkJet.OpenDatabase("Northwind.mdb")

   ' Create ODBCDirect Workspace object and open Connection
   ' objects.
   Set wrkODBC = CreateWorkspace("NewODBCWorkspace", _
      "admin", "", dbUseODBC)

   ' Note: The DSN referenced below must be configured to 
   '       use Microsoft Windows NT Authentication Mode to 
   '       authorize user access to the Microsoft SQL Server.
    Set conPubs = wrkODBC.OpenConnection("Connection1", , , _
        "ODBC;DATABASE=pubs;DSN=Publishers")

   ' Show three different uses for the Version property.
   Debug.Print "Version of DBEngine (Microsoft Jet " & _
      "in memory) = " & DBEngine.Version
   Debug.Print "Version of the Microsoft Jet engine " & _
      "with which " & dbsNorthwind.Name & _
      " was created = " & dbsNorthwind.Version
   Debug.Print "Version of ODBCDirect connection " & _
      "(using Database property) = " & _
      conPubs.Database.Version

   dbsNorthwind.Close
   conPubs.Close
   wrkJet.Close
   wrkODBC.Close

End Sub